package com.ssyt.blog.core.sys.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.DynamicUpdate;

import com.ssyt.blog.core.common.util.DateUtil;

@Entity
@Table(name = "discuss", catalog = "blog")
@DynamicUpdate
public class Discuss implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	private Integer id;
	private String content;
	@Column(name = "create_time", nullable = false, length = 19)
	private Date createTime;
	@Column(name = "article_id", nullable = false)
	private Integer articleId;
	@Column(name = "user_id", nullable = false)
	private Integer userId;

	@Transient
	private String userName;
	@Transient
	private String photo;

	public Discuss() {
	}

	public Discuss(Integer id, String content, Date createTime,
			Integer articleId, Integer userId) {
		super();
		this.id = id;
		this.content = content;
		this.createTime = createTime;
		this.articleId = articleId;
		this.userId = userId;
	}

	public Discuss(Integer id, String content, Date createTime,
			Integer articleId, Integer userId, String userName, String photo) {
		super();
		this.id = id;
		this.content = content;
		this.createTime = createTime;
		this.articleId = articleId;
		this.userId = userId;
		this.userName = userName;
		this.photo = photo;
	}

	public Discuss(Integer id, String content, Date createTime, Integer userId,
			String userName, String photo) {
		super();
		this.id = id;
		this.content = content;
		this.createTime = createTime;
		this.userId = userId;
		this.userName = userName;
		this.photo = photo;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPhoto() {
		return photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getCreateTime() {
		return DateUtil.format(this.createTime, "yyyy-MM-dd    HH:mm");
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Integer getArticleId() {
		return this.articleId;
	}

	public void setArticleId(Integer articleId) {
		this.articleId = articleId;
	}

	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

}